<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	
</head>
<body>
	<input type="text" id="clock" size="35"/>
<script language=javascript>
	var int=self.setInterval("clock()",50)//定时器
	function clock(){
		//产生一个时间对象
	  	var t=new Date()
	  	//附值到id为clock这个地方
	  	document.getElementById("clock").value=t
	}
</script>
<button onclick="int=window.clearInterval(int)">
	Stop interval</button>//清除定时器
</body>
</html>